package com.jrx.anytxn.transaction.controller.api;

import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.feign.api.request.LoanPayOffReq;
import com.jrx.anytxn.i18n.response.TxnRespResult;
import com.jrx.anytxn.transaction.dto.payment.BillPayTrailReq;
import com.jrx.anytxn.transaction.dto.payment.BillPayTrailRes;
import com.jrx.anytxn.transaction.dto.payment.CustPayOffQueryRes;
import com.jrx.anytxn.transaction.handler.IPaymentHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author chenj
 * @date 2022/10/8 15:31
 */

@Api(tags = "客户借据结清信息查询")
@RestController
@RequestMapping(value = "/api/transaction/payoff")
public class PayOffInfoController {
    private static final Logger logger = LoggerFactory.getLogger(PaymentController.class);
    @Autowired
    private IPaymentHandler paymentHandler;


    @ApiOperation(value = "借据结清信息查询", notes = "借据结清信息查询-默认只提供给信用就医")
    @PostMapping(value = "/loanInfoQuery")
    public TxnRespResult<CustPayOffQueryRes> loanInfoQuery(@Valid @RequestBody LoanPayOffReq loanPayOffReq) throws TxnException {
        TxnRespResult<CustPayOffQueryRes> result = new TxnRespResult<>();
        CustPayOffQueryRes res = paymentHandler.loanInfoQuery(loanPayOffReq);
        result.getSuccess(res);
        return result;
    }
}
